.PHONY: build clean tool lint help

currentdir := $(shell pwd)
all: build

build:
	@go mod tidy
	@go build -x -v -o cloud
	# @go build main.go CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go
tool:
	go vet ./...; true
	gofmt -w .

lint:
	golint ./...

clean:
	rm -rf go-gin-example
	go clean -i .

help:
	@echo "make: compile packages and dependencies"
	@echo "make tool: run specified go tool"
	@echo "make lint: golint ./..."
	@echo "make clean: remove object files and cached files"

serve:
	@kill $(ps -aux | grep cloud_api | awk 'NR==1{print $2}')
	@./cloud_api

run-ajy:
	@go run pkg/openai/aijieyun/cmd/main.go

test-ajy:
	@go test -v -count=1  -run=^TestCreateInstance$ "github.com/EDDYCJY/go-gin-example/routers/openai"
run:
	@go run .

docker-build:
	@docker run -it --rm -v $(pwd):/app --name my-go-app my-go-app make build